package com.project.controller;

import com.project.bean.AssessBean;
import com.project.bean.UserBean;
import com.project.service.IAssessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@RequestMapping("assess")
public class AssessController {
    @Autowired
    private IAssessService service;
    @RequestMapping("add")
    public List<AssessBean> add(String content,int goodsId, HttpServletRequest req){
        //从session中得到登陆用户
        UserBean user = (UserBean) req.getSession().getAttribute("loginUser");
        AssessBean assess = new AssessBean(content,user.getId(),goodsId);
        List<AssessBean>list = service.add(assess);
        return list;
    }
}
